// pages/daohang/index.js
Page({
  data: {
  },
  onLoad: function (options) {
    console.log(options)
    // this去调用getData方法，并且传入四个参数1
    this.getData(options.fromLat,options.fromLng,options.toLat,options.toLng)

  },
  // 对应接收Onload方法调用时传过来的参数
  getData(fromLat,fromLng,toLat,toLng){
    var _this = this
    wx.request({
      url: 'https://swxy.ncscu.cn/api/navigation/?from='+fromLat+','+fromLng+'&to='+toLat+','+toLng,
      method:'GET',
      success(res){
        console.log(res.data.result.routes[0].steps)
        _this.setData({
          steps:res.data.result.routes[0].steps
        })
      }
    })
  }
})